< previous page page_945 next page >

Page 945
· It makes the API call depending upon the value passed:
If nFlag = True Then
      If nHelpCmd = HELP_PARTIALKEY Then
         i = WinHelp(frmForm.hWnd, App.HelpFile, nHelpCmd, "")
      Else
         i = WinHelp(frmForm.hWnd, App.HelpFile, nHelpCmd, 0&)
      End If
   Else
      MsgBox "Invalid Help Command Value"
   End If
HelpFile_Exit:
End Sub
The WinAboutPage procedure makes an API call to display an About box. Parameters are passed for a company name and a technical support number:
Sub WinAboutPage (frm As Form)
   Dim MoreInfo$
   '
   MoreInfo$ = "Copyright " + Chr$(169) + " 1994 Software Company, Inc."
   MoreInfo$ = MoreInfo$ + Chr$(13) + "Technical Support: 800-555-7777"
   '
   Call ShellAbout(frm.hWnd, app.Title, MoreInfo$, frm.Icon)
End Sub
The Click events for the menu items are defined to call the HelpFile procedure and pass the appropriate parameters:
Sub mnuContents_Click ()
   Helpfile Me, Help_index
End Sub
Sub mnuSearch_Click ()
   HelpFile Me, Help_PartialKey
End Sub
Sub mnuHelponHelp_Click ()
HelpFile Me, Help_HelponHelp
End Sub
Sub mnuAbout_Click ()
    WinAboutPage Me
End Sub
Sub mnuExit.Click()
   Unload Me
End Sub
Finally, when the form unloads, housekeeping should be performed and any help screens that have been left open should be closed. This is the role of the Form_Unload event.
Sub Form_Unload (Cancel As Integer)
   HelpFile Me, Help_Quit
End Sub
Please note that Unload Me was used in the Exit menu item rather than End. Using the End command would stop execution of the program without triggering the Unload event.

 
< previous page page_945 next page >

If you like this book, buy it!